<?php
/**
 * SocialEngine
 *
 * @category   Application_Extensions
 * @package    Page
 * @copyright  Copyright Hire-Experts LLC
 * @license    http://www.hire-experts.com
 * @version    $Id: _googleMapStat.tpl 2010-08-31 17:53 idris $
 * @author     Idris
 */
?>

<?php $this->headScript()->appendFile('http://www.google.com/jsapi'); ?>

<script type="text/javascript">
google.load('visualization', '1', {'packages': ['geomap']});
google.setOnLoadCallback(drawMap);
function drawMap() {
    var data = new google.visualization.DataTable();
    data.addRows(6);
    data.addColumn('string', 'Country');
    data.addColumn('number', 'Popularity');
    <?php 
    if ($this->map_items){
	    foreach ($this->map_items as $key => $item){
	    	echo "data.setValue({$key}, 0, '{$item['name']}');";
	    	echo "data.setValue({$key}, 1, {$item['count']});";
	    }
    }
    ?>
    var options = {};
    options['dataMode'] = 'regions';
    options['width'] = 900;
    options['height'] = 500;
    
    var container = document.getElementById('map_canvas');
    var geomap = new google.visualization.GeoMap(container);
    geomap.draw(data, options);
};

</script>

<div class="map_canvas_stat"><div id='map_canvas'></div></div>
<div class="clr"></div>